/**
 * Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bangyu.monitor.modular.system.controller;

import cn.hutool.core.bean.BeanUtil;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.exception.ServiceException;
import com.bangyu.monitor.core.common.annotion.BussinessLog;
import com.bangyu.monitor.core.common.annotion.Permission;
import com.bangyu.monitor.core.common.constant.Const;
import com.bangyu.monitor.core.common.constant.dictmap.BridgeDict;
import com.bangyu.monitor.core.common.exception.BizExceptionEnum;
import com.bangyu.monitor.core.common.page.LayuiPageFactory;
import com.bangyu.monitor.core.log.LogObjectHolder;
import com.bangyu.monitor.core.util.BindingResultUtil;
import com.bangyu.monitor.modular.system.biz.BridgeBiz;
import com.bangyu.monitor.modular.system.entity.Area;
import com.bangyu.monitor.modular.system.entity.Bridge;
import com.bangyu.monitor.modular.system.model.BridgeDto;
import com.bangyu.monitor.modular.system.service.AreaService;
import com.bangyu.monitor.modular.system.service.BridgeService;
import com.bangyu.monitor.modular.system.warpper.BridgeWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * 地区controller
 */
@Controller
@RequestMapping("/area")
@Slf4j
public class AreaController extends BaseController {


    @Autowired
    private AreaService areaService;

    /**
     * 根据父编码获取地区列表
     * @param parentCode
     * @return
     */
    @RequestMapping("/queryAreaByParentCode")
    @ResponseBody
    public ResponseData queryAreaByParentCode(@RequestParam(value = "parentCode") Integer parentCode) {

        return ResponseData.success(areaService.queryByParentCode(parentCode));
    }

    /**
     * 获取省列表
     * @return
     */
    @RequestMapping("/queryProvince")
    @ResponseBody
    public ResponseData queryProvince() {

        return ResponseData.success(areaService.queryProvince());
    }




}
